package demo2;

public class 懒汉模式多线程改进 {
    private static volatile 懒汉模式多线程改进 instance = null;

    private 懒汉模式多线程改进() {

    }

    public static 懒汉模式多线程改进 getInstance() {
        if (instance == null) {
            synchronized (懒汉模式多线程改进.class) {
                if (instance == null) {
                    instance = new 懒汉模式多线程改进();
                }
            }
        }
        return instance;
    }

}
